var path = require('path');
var htmlWP = require('html-webpack-plugin');

module.exports = {
    entry:  './src/main.js',
    output: {
        path: path.resolve(__dirname, '/dist'),
        filename: 'build.js'
    },
    module: {
        /* loaders: [
            {
                test: /\.css$/,
                loader: 'style-loader!css-loader'
            },
            {
                test: /\.scss$/,
                loader: 'style-loader!css-loader!sass-loader'
            },
            {
                test: /\.less$/,
                loader: 'style-loader!css-loader!less-loader'
            },
            {
                test: /\.(png|jpg|gif|ttf)$/,
                loader: 'url-loader?limit=20000'
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                exclude: /node_modules/,    //将module忽略装换
                
            },
            {
                test: /\.js$/,
                use: [
                    {
                        loader: 'babel-loader',
                        options: {
                            presets: ['es2015']
                        }
                    }
                ]
            }
        ], */
        rules: [
            {
                test: /\.css$/,
                loader: 'style-loader!css-loader'
            },
            {
                test: /\.scss$/,
                loader: 'style-loader!css-loader!sass-loader'
            },
            {
                test: /\.less$/,
                loader: 'style-loader!css-loader!less-loader'
            },
            {
                test: /\.(png|jpg|gif|ttf)$/,
                loader: 'url-loader?limit=20000'
            },
            {
                test: /\.js$/,
                use: [
                    {
                        loader: 'babel-loader',
                        options: {
                            presets: ['es2015']
                            /* plugins:['transform-runtime']   //用来解析Vue文件 */
                        }
                    }
                ]
            }
            /* {
                test: /.vue$/,
                loader:'vue-loader'
            } */
        ]
    },
    plugins: [
        new htmlWP({
            title: '首页',
            filename: 'index.html',
            template: 'index1.html'
        })
    ]
}